package com.zhudi.model.emun;


import com.zhudi.annotation.AuthCheck;

public enum AuthEnum {
    ADMIN("ADMIN",1),
    USER("USER",0);

    private String role;
    private Integer value;


    /**
     * 根据value找到对应的枚举类
     * @param role 状态
     * @return 对应的枚举类
     */
    public static AuthEnum getSatus(String role){
        //遍历枚举类来找到value对应的那个枚举
        for (AuthEnum authEnum : AuthEnum.values()) {
            if (authEnum.getRole().equals(role)){
                return authEnum;
            }
        }
        //如果找不到则返回空
        return null;
    }

    AuthEnum(String role, Integer value) {
        this.role = role;
        this.value = value;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }
}
